#!/bin/sh -eux

run_gradle() {
  ./gradlew --continue --no-build-cache --stacktrace "$@"
}

case "$(javac -version 2>&1)" in
  (javac\ 1.8.*)
     # ECJ compilation checks only need to run on one operating system
     if [ "${TRAVIS_OS_NAME:-}" = linux ]; then
       run_gradle javadoc build publishToMavenLocal
     else
       run_gradle javadoc build publishToMavenLocal -PskipJavaUsingEcjTasks
     fi
     ;;
  (*)
    run_gradle :com.ibm.wala.core:test
    ;;
esac

./check-git-cleanliness.sh
